package net.jgrm.order.dto;

import lombok.Data;
import net.jgrm.order.entity.ReceiverInfo;

import javax.validation.Valid;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;

/**
 * 创建订单请求DTO
 */
@Data
public class CreateOrderRequest {

    /**
     * 用户ID
     */
    @NotNull(message = "用户ID不能为空")
    private Long userId;

    /**
     * 商品ID
     */
    @NotNull(message = "商品ID不能为空")
    private Long productId;

    /**
     * 购买数量
     */
    @NotNull(message = "购买数量不能为空")
    @Min(value = 1, message = "购买数量必须大于0")
    private Integer quantity;

    /**
     * 收货人信息
     */
    @NotNull(message = "收货人信息不能为空")
    @Valid
    private ReceiverInfo receiverInfo;
}